package net.introlab.scraper;

import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

public abstract class BaseScraper<T> implements Scraper<T> {

    private final Element element;

    public BaseScraper(Element element) {
        this.element = element;
    }

    @Override
    public T call() throws Exception {
        Document document = getDocument(element);
        return parseDocument(document);
    }

    protected abstract T parseDocument(Document document);

    protected abstract Document getDocument(Element element);
}
